/*
 * Copyright 2021 by LunaSec (owned by Refinery Labs, Inc)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
/* tslint:disable */

/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */
export type DefinitionsDeployment = {
  mode?: string;
  endpoint_mode?: string;
  replicas?: number;
  labels?: ListOrDict;
  rollback_config?: {
    parallelism?: number;
    delay?: string;
    failure_action?: string;
    monitor?: string;
    max_failure_ratio?: number;
    order?: 'start-first' | 'stop-first';
  };
  update_config?: {
    parallelism?: number;
    delay?: string;
    failure_action?: string;
    monitor?: string;
    max_failure_ratio?: number;
    order?: 'start-first' | 'stop-first';
  };
  resources?: {
    limits?: {
      cpus?: number | string;
      memory?: string;
    };
    reservations?: {
      cpus?: number | string;
      memory?: string;
      generic_resources?: DefinitionsGenericResources;
      devices?: DefinitionsDevices;
    };
  };
  restart_policy?: {
    condition?: string;
    delay?: string;
    max_attempts?: number;
    window?: string;
  };
  placement?: {
    constraints?: string[];
    preferences?: {
      spread?: string;
    }[];
    max_replicas_per_node?: number;
  };
} & Deployment;
export type ListOrDict =
  | {
      /**
       * This interface was referenced by `undefined`'s JSON-Schema definition
       * via the `patternProperty` ".+".
       */
      [k: string]: string | number | boolean | null;
    }
  | string[];
export type DefinitionsGenericResources = {
  discrete_resource_spec?: {
    kind?: string;
    value?: number;
  };
}[];
export type ListOfStrings = string[];
export type DefinitionsDevices = {
  capabilities?: ListOfStrings;
  count?: string | number;
  device_ids?: ListOfStrings;
  driver?: string;
  options?: ListOrDict;
}[];
export type Deployment = {
  mode?: string;
  endpoint_mode?: string;
  replicas?: number;
  labels?: ListOrDict;
  rollback_config?: {
    parallelism?: number;
    delay?: string;
    failure_action?: string;
    monitor?: string;
    max_failure_ratio?: number;
    order?: 'start-first' | 'stop-first';
  };
  update_config?: {
    parallelism?: number;
    delay?: string;
    failure_action?: string;
    monitor?: string;
    max_failure_ratio?: number;
    order?: 'start-first' | 'stop-first';
  };
  resources?: {
    limits?: {
      cpus?: number | string;
      memory?: string;
    };
    reservations?: {
      cpus?: number | string;
      memory?: string;
      generic_resources?: DefinitionsGenericResources;
      devices?: DefinitionsDevices;
    };
  };
  restart_policy?: {
    condition?: string;
    delay?: string;
    max_attempts?: number;
    window?: string;
  };
  placement?: {
    constraints?: string[];
    preferences?: {
      spread?: string;
    }[];
    max_replicas_per_node?: number;
  };
} | null;
export type StringOrList = string | ListOfStrings;
/**
 * This interface was referenced by `PropertiesNetworks`'s JSON-Schema definition
 * via the `patternProperty` "^[a-zA-Z0-9._-]+$".
 */
export type DefinitionsNetwork = {
  name?: string;
  driver?: string;
  driver_opts?: {
    /**
     * This interface was referenced by `undefined`'s JSON-Schema definition
     * via the `patternProperty` "^.+$".
     */
    [k: string]: string | number;
  };
  ipam?: {
    driver?: string;
    config?: {
      subnet?: string;
      ip_range?: string;
      gateway?: string;
      aux_addresses?: {
        /**
         * This interface was referenced by `undefined`'s JSON-Schema definition
         * via the `patternProperty` "^.+$".
         */
        [k: string]: string;
      };
    }[];
    options?: {
      /**
       * This interface was referenced by `undefined`'s JSON-Schema definition
       * via the `patternProperty` "^.+$".
       */
      [k: string]: string;
    };
  };
  external?:
    | boolean
    | {
        name?: string;
      };
  internal?: boolean;
  enable_ipv6?: boolean;
  attachable?: boolean;
  labels?: ListOrDict;
} & Network;
export type Network = {
  name?: string;
  driver?: string;
  driver_opts?: {
    /**
     * This interface was referenced by `undefined`'s JSON-Schema definition
     * via the `patternProperty` "^.+$".
     */
    [k: string]: string | number;
  };
  ipam?: {
    driver?: string;
    config?: {
      subnet?: string;
      ip_range?: string;
      gateway?: string;
      aux_addresses?: {
        /**
         * This interface was referenced by `undefined`'s JSON-Schema definition
         * via the `patternProperty` "^.+$".
         */
        [k: string]: string;
      };
    }[];
    options?: {
      /**
       * This interface was referenced by `undefined`'s JSON-Schema definition
       * via the `patternProperty` "^.+$".
       */
      [k: string]: string;
    };
  };
  external?:
    | boolean
    | {
        name?: string;
      };
  internal?: boolean;
  enable_ipv6?: boolean;
  attachable?: boolean;
  labels?: ListOrDict;
} | null;
/**
 * This interface was referenced by `PropertiesVolumes`'s JSON-Schema definition
 * via the `patternProperty` "^[a-zA-Z0-9._-]+$".
 */
export type DefinitionsVolume = {
  name?: string;
  driver?: string;
  driver_opts?: {
    /**
     * This interface was referenced by `undefined`'s JSON-Schema definition
     * via the `patternProperty` "^.+$".
     */
    [k: string]: string | number;
  };
  external?:
    | boolean
    | {
        name?: string;
      };
  labels?: ListOrDict;
} & Volume;
export type Volume = {
  name?: string;
  driver?: string;
  driver_opts?: {
    /**
     * This interface was referenced by `undefined`'s JSON-Schema definition
     * via the `patternProperty` "^.+$".
     */
    [k: string]: string | number;
  };
  external?:
    | boolean
    | {
        name?: string;
      };
  labels?: ListOrDict;
} | null;

/**
 * The Compose file is a YAML file defining a multi-containers based application.
 */
export interface ComposeSpecification {
  /**
   * Version of the Compose specification used. Tools not implementing required version MUST reject the configuration file.
   */
  version?: string;
  services?: PropertiesServices;
  networks?: PropertiesNetworks;
  volumes?: PropertiesVolumes;
  secrets?: PropertiesSecrets;
  configs?: PropertiesConfigs;
}
export interface PropertiesServices {
  [k: string]: DefinitionsService;
}
/**
 * This interface was referenced by `PropertiesServices`'s JSON-Schema definition
 * via the `patternProperty` "^[a-zA-Z0-9._-]+$".
 */
export interface DefinitionsService {
  deploy?: DefinitionsDeployment;
  build?:
    | string
    | {
        context?: string;
        dockerfile?: string;
        args?: ListOrDict;
        labels?: ListOrDict;
        cache_from?: string[];
        network?: string;
        target?: string;
        shm_size?: number | string;
        extra_hosts?: ListOrDict;
        isolation?: string;
      };
  blkio_config?: {
    device_read_bps?: BlkioLimit[];
    device_read_iops?: BlkioLimit[];
    device_write_bps?: BlkioLimit[];
    device_write_iops?: BlkioLimit[];
    weight?: number;
    weight_device?: BlkioWeight[];
  };
  cap_add?: string[];
  cap_drop?: string[];
  cgroup_parent?: string;
  command?: string | string[];
  configs?: (
    | string
    | {
        source?: string;
        target?: string;
        uid?: string;
        gid?: string;
        mode?: number;
      }
  )[];
  container_name?: string;
  cpu_count?: number;
  cpu_percent?: number;
  cpu_shares?: number | string;
  cpu_quota?: number | string;
  cpu_period?: number | string;
  cpu_rt_period?: number | string;
  cpu_rt_runtime?: number | string;
  cpus?: number | string;
  cpuset?: string;
  credential_spec?: {
    config?: string;
    file?: string;
    registry?: string;
  };
  depends_on?:
    | ListOfStrings
    | {
        /**
         * This interface was referenced by `undefined`'s JSON-Schema definition
         * via the `patternProperty` "^[a-zA-Z0-9._-]+$".
         */
        [k: string]: {
          condition: 'service_started' | 'service_healthy' | 'service_completed_successfully';
        };
      };
  device_cgroup_rules?: ListOfStrings;
  devices?: string[];
  dns?: StringOrList;
  dns_opt?: string[];
  dns_search?: StringOrList;
  domainname?: string;
  entrypoint?: string | string[];
  env_file?: StringOrList;
  environment?: ListOrDict;
  expose?: (string | number)[];
  extends?:
    | string
    | {
        service: string;
        file?: string;
      };
  external_links?: string[];
  extra_hosts?: ListOrDict;
  group_add?: (string | number)[];
  healthcheck?: DefinitionsHealthcheck;
  hostname?: string;
  image?: string;
  init?: boolean;
  ipc?: string;
  isolation?: string;
  labels?: ListOrDict;
  links?: string[];
  logging?: {
    driver?: string;
    options?: {
      /**
       * This interface was referenced by `undefined`'s JSON-Schema definition
       * via the `patternProperty` "^.+$".
       */
      [k: string]: string | number | null;
    };
  };
  mac_address?: string;
  mem_limit?: number | string;
  mem_reservation?: string | number;
  mem_swappiness?: number;
  memswap_limit?: number | string;
  network_mode?: string;
  networks?:
    | ListOfStrings
    | {
        /**
         * This interface was referenced by `undefined`'s JSON-Schema definition
         * via the `patternProperty` "^[a-zA-Z0-9._-]+$".
         */
        [k: string]: {
          aliases?: ListOfStrings;
          ipv4_address?: string;
          ipv6_address?: string;
          link_local_ips?: ListOfStrings;
          priority?: number;
        } | null;
      };
  oom_kill_disable?: boolean;
  oom_score_adj?: number;
  pid?: string | null;
  pids_limit?: number | string;
  platform?: string;
  ports?: (
    | number
    | string
    | {
        mode?: string;
        host_ip?: string;
        target?: number;
        published?: number;
        protocol?: string;
      }
  )[];
  privileged?: boolean;
  profiles?: ListOfStrings;
  pull_policy?: 'always' | 'never' | 'if_not_present' | 'build' | 'missing';
  read_only?: boolean;
  restart?: string;
  runtime?: string;
  scale?: number;
  security_opt?: string[];
  shm_size?: number | string;
  secrets?: (
    | string
    | {
        source?: string;
        target?: string;
        uid?: string;
        gid?: string;
        mode?: number;
      }
  )[];
  sysctls?: ListOrDict;
  stdin_open?: boolean;
  stop_grace_period?: string;
  stop_signal?: string;
  storage_opt?: {
    [k: string]: unknown;
  };
  tmpfs?: StringOrList;
  tty?: boolean;
  ulimits?: {
    /**
     * This interface was referenced by `undefined`'s JSON-Schema definition
     * via the `patternProperty` "^[a-z]+$".
     */
    [k: string]:
      | number
      | {
          hard: number;
          soft: number;
        };
  };
  user?: string;
  userns_mode?: string;
  volumes?: (
    | string
    | {
        type: string;
        source?: string;
        target?: string;
        read_only?: boolean;
        consistency?: string;
        bind?: {
          propagation?: string;
          create_host_path?: boolean;
        };
        volume?: {
          nocopy?: boolean;
        };
        tmpfs?: {
          size?: number | string;
        };
      }
  )[];
  volumes_from?: string[];
  working_dir?: string;
}
export interface BlkioLimit {
  path?: string;
  rate?: number | string;
}
export interface BlkioWeight {
  path?: string;
  weight?: number;
}
export interface DefinitionsHealthcheck {
  disable?: boolean;
  interval?: string;
  retries?: number;
  test?: string | string[];
  timeout?: string;
  start_period?: string;
}
export interface PropertiesNetworks {
  [k: string]: DefinitionsNetwork;
}
export interface PropertiesVolumes {
  [k: string]: DefinitionsVolume;
}
export interface PropertiesSecrets {
  [k: string]: DefinitionsSecret;
}
/**
 * This interface was referenced by `PropertiesSecrets`'s JSON-Schema definition
 * via the `patternProperty` "^[a-zA-Z0-9._-]+$".
 */
export interface DefinitionsSecret {
  name?: string;
  file?: string;
  external?:
    | boolean
    | {
        name?: string;
        [k: string]: unknown;
      };
  labels?: ListOrDict;
  driver?: string;
  driver_opts?: {
    /**
     * This interface was referenced by `undefined`'s JSON-Schema definition
     * via the `patternProperty` "^.+$".
     */
    [k: string]: string | number;
  };
  template_driver?: string;
}
export interface PropertiesConfigs {
  [k: string]: DefinitionsConfig;
}
/**
 * This interface was referenced by `PropertiesConfigs`'s JSON-Schema definition
 * via the `patternProperty` "^[a-zA-Z0-9._-]+$".
 */
export interface DefinitionsConfig {
  name?: string;
  file?: string;
  external?:
    | boolean
    | {
        name?: string;
        [k: string]: unknown;
      };
  labels?: ListOrDict;
  template_driver?: string;
}
